﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using bdxyit.com.RecruitmentAppSys.ViewModels;
using System.Web.Routing;
using System.Web.Security;
using bdxyit.com.RecruitmentAppSys.Models;

namespace bdxyit.com.RecruitmentAppSys.Controllers
{
    public class UserInfoController : Controller
    {

        public IFormsAuthenticationService FormsService { get; set; }
        public IMembershipService MembershipService { get; set; }
        // GET: /SystemInfo/

        public ActionResult Index(string id)
        {
            var userInfo = new UserInfo();
            userInfo.UserID = id;
            return View(userInfo);
        }

        //
        // GET: /SystemInfo/Details/5

        public ActionResult Details(string id)
        {
            var userInfo = new UserInfo();
            userInfo.UserID = id;
            return View(userInfo);
        }

        //
        // GET: /SystemInfo/Create

        public ActionResult Create(string id)
        {
            var userinfor = new UserInfo();
            userinfor.UserID = id;
            return View(userinfor);
        } 

        //
        // POST: /SystemInfo/Create
        [HttpPost]
        public ActionResult Create(UserInfo UserInfo)
        {
            try
            {
                //var uif = rdb.UserInfos.SingleOrDefault(u => u.UserID == UserInfo.UserID);
                //if (uif != null)
                //{
                //    uif.PhotoAddress = UserInfo.PhotoAddress;
                //}
                //rdb.SaveChanges();
               //return RedirectToAction("Register", "Account", new { usernme = uif.UserID, password = uif.UserID.Substring(uif.UserID.Length - 6, 6).Replace('X', '0'), email = uif.Email });
           }
            catch
            {
                return RedirectToAction("Index");
            }
            return RedirectToAction("Index");
        }
        
        //
        // GET: /SystemInfo/Edit/5
 
        public ActionResult Edit(int id)
        {
            return View();
        }

        //
        // POST: /SystemInfo/Edit/5

        [HttpPost]
        public ActionResult Edit(int id, UserInfo UserInfo)
        {
            try
            {
                // TODO: Add update logic here
 
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }

        //
        // GET: /SystemInfo/Delete/5
 
        public ActionResult Delete(int id)
        {
            return View();
        }

        //
        // POST: /SystemInfo/Delete/5

        [HttpPost]
        public ActionResult Delete(int id, UserInfo UserInfo)
        {
            try
            {
                // TODO: Add delete logic here
 
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
    }
}
